package com.sscaipiao.android.utils;

/**
 * Created by ppona_000 on 14-1-6.
 */
public class MathUtil {
	public static long calcFactorial(int n) {
		long ret = 1;
		for (int i = 0; i < n; i++) {
			ret = ret * (n - i);
		}
		return ret;
	}
	public static long calcCNM(int n, int m) {
		long ret1 = 1;
		long ret2 = calcFactorial(n - m);
		for (int i = 0; i < n; i++) {
			if (i >= n - m) {
				break;
			}
			ret1 = ret1 * (n - i);
		}
		return ret1/ ret2;
	}


}
